<?
 	session_start();
 	require("connect.php"); 	
?>
<html><!-- InstanceBegin template="/Templates/lopctntemplate.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language="Javascript" src="scripts/innovaeditor.js"></script>
<link rel="stylesheet" type="text/css" href="css/engine.css" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<script language="javascript" type="text/javascript" src="js/datetimepicker.js">
</script>
</head>
<body>
<table align="center" width="938" cellpadding="0" cellspacing="0" border="0">
	<tr><td colspan="3" height="26" bgcolor="#CCCCCC">		
	<? $malop=$_REQUEST["mal"];
		$resu99=mysql_query("select * from lop where mal='{$malop}'");
		$row99=mysql_fetch_array($resu99);
	?>	
	<!--Menu 1-->
	<div id="tool">

	<a href="index.php">Trang chủ trường</a>
		 | 
		 <a href="hotrohoctap.php">Hỗ trợ học tập</a>
		 |				 
		<a href="lienhe.php">Liên hệ</a>
	</div>
	<!--het menu 1-->
	</td></tr>
	<tr><td colspan="3" height="34" bgcolor="#CCCCCC">	
	<div id="menuwrapper">
		<ul id="p7menubar">
			 <li><a class="trigger" href="lopcuatoi.php?mal=<? echo $malop;?>" target="_self">Trang chủ lớp <? echo $row99["tenl"];?></a></li>										  	
		  <li class="linemenus"></li>					 
		  <li>
		  <?
		  	if ($_SESSION["login"]!=true){
		  ?>		  
		  <a class="trigger" href="login.php" target="_self">Trang cá nhân</a>
		  <? } else {
		  		if($_SESSION["quyen"]==0) {
		  ?>	
		   			<a class="trigger" href="admin/index.php" target="_self">Trang cá nhân</a>
		  		<? } else if($_SESSION["quyen"]==1) {?>
					<a class="trigger" href="giaovien.php?magv=<? echo $_SESSION["username"];?>" target="_self">Trang cá nhân</a>
				<? } else if($_SESSION["quyen"]==2) {?>
					<a class="trigger" href="trangphuhuynh.php?maph=<? echo $_SESSION["username"];?>&mal=<? echo $malop;?>" target="_self">Trang cá nhân</a>
				<? } else if(($_SESSION["quyen"]==3) || ($_SESSION["quyen"]==4)) {?>
					<a class="trigger" href="tranghocsinh.php?mahs=<? echo $_SESSION["username"];?>&mal=<? echo $malop;?>" target="_self">Trang cá nhân</a>
				<? }?>
		  		
		  <? }?>
		  <!--bat dau phan dang nhap-->
		  <?
				if ($_SESSION["login"]!=true){
			?>
			 <li class="linemenus"></li>					 
		  	 <li><a class="trigger" href="login.php" target="_self">Đăng nhập</a>			
			<? }else{?>
			 <li class="linemenus"></li>					 
		  	 <li><a class="trigger" href="logout.php" target="_self">Thoát</a>			
			 <li class="linemenus"></li>
			 <li><a class="trigger">
			 	<?
		$nguoidung=$_SESSION["username"];
		if($_SESSION["quyen"]==0){
		$resu23=mysql_query("select * from admin where maadmin='{$nguoidung}'");
		$row23=mysql_fetch_array($resu23);
		?>
			<font color="#FFFFFF">			 
			<? echo "Xin chào : ".$row23["hotendem"]."&nbsp;".$row23["ten"]; ?>
			</font>
		<? }else if($_SESSION["quyen"]==1){
			$resu23=mysql_query("select * from giaovien where magv='{$nguoidung}'");
			$row23=mysql_fetch_array($resu23);
		?>
			<font color="#FFFFFF">			 
			<? echo "Xin chào : ".$row23["hotendem"]."&nbsp;".$row23["ten"]; ?>
			</font>
		<? }else if($_SESSION["quyen"]==2){
			$resu23=mysql_query("select * from phuhuynh where maph='{$nguoidung}'");
			$row23=mysql_fetch_array($resu23);
		?>
			<font color="#FFFFFF">			 
			<? echo "Xin chào : ".$row23["tenph"]; ?>
			</font>
		<? }else if(($_SESSION["quyen"]==3)||($_SESSION["quyen"]==4)){
				$resu23=mysql_query("select * from hocsinh where mahs='{$nguoidung}'");
				$row23=mysql_fetch_array($resu23);
		?>
			<font color="#FFFFFF">			 
			<? echo "Xin chào : ".$row23["hotendem"]."&nbsp;".$row23["ten"]; ?>
			</font>
		<? }
	}?>
		  <!--het-->		 
		</ul>
	</div>	
	</td></tr>
	<tr>
		<td width="160px" height="800" valign="top">		
		<!--menu trai-->
		<table align="center" width="100%" border="1" cellpadding="0" cellspacing="0">
		<tr><td valign="middle" height="30">
			<a href="sodaubai.php?mal=<? echo $malop;?>"><img src="anh/sodaubai.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="sodaubai.php?mal=<? echo $malop;?>">Sổ đầu bài</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="danhsachhocsinh.php?mal=<? echo $malop;?>"><img src="anh/user.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="danhsachhocsinh.php?mal=<? echo $malop;?>">Danh sách học sinh</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="thuvienanhlop.php?mal=<? echo $malop;?>.php"><img src="anh/album.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="thuvienanhlop.php?mal=<? echo $malop;?>">Thư viện ảnh</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="lopcuatoi_baiviet.php?mal=<? echo $malop;?>"><img src="anh/baiviet.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="lopcuatoi_baiviet.php?mal=<? echo $malop;?>">Bài viết</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="thoikhoabieu.php?mal=<? echo $malop;?>"><img src="anh/thoikhoabieu.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="thoikhoabieu.php?mal=<? echo $malop;?>">Thời khóa biểu</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="thongbaolop.php?mal=<? echo $malop;?>"><img src="anh/thongbao.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="thongbaolop.php?mal=<? echo $malop;?>">Thông báo</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="tailieulop.php?mal=<? echo $malop;?>""><img src="anh/tailieu.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="tailieulop.php?mal=<? echo $malop;?>">Tài liệu Upload</a>
		</td></tr>
		<tr><td valign="middle" height="30">
			<a href="xemdiemlop.php?mal=<? echo $malop;?>""><img src="anh/xemdiem.png" height="16" width="16" border="0">&nbsp;&nbsp;</a><a href="xemdiemlop.php?mal=<? echo $malop;?>">Xem điểm</a>
		</td></tr>				
		</table>
		<!-- het menu trai-->
		</td>
		
    <td align="center" valign="top"><!-- InstanceBeginEditable name="EditRegion3" -->
	<table align="center" cellpadding="1" cellspacing="1" border="0" width="99%">
	<?		
		$mal=$_REQUEST["mal"];
		$mabv=$_REQUEST["mabv"];
		$result=mysql_query("select * from baiviet where mabv='{$mabv}'");
		$r=mysql_fetch_array($result);
		$result3=mysql_query("select * from loaibaiviet where malbv='{$r["malbv"]}'");
		$r3=mysql_fetch_array($result3);
	?>
	<tr>	
	<td align="center">				
				<!--Begin-->
				<div class="gift_box_quatang">
					<div class="gift_quatang_topblog">
						<p class="gift_quatang_fl_left"><img src="anh/space.gif"></p>
						<p class="gift_quatang_fl_right"><img src="anh/space.gif"></p>
					</div>
					<div class="gift_quatang_infoblog">
						<h1 align="left"><font color="#CC3333">Bài viết -> <? echo $r["tieude"];?></font></h1>
						<table align="center" cellpadding="0" cellspacing="3" border="0" width="100%">
							<tr><td class="tieude1"><? echo $r["tieude"];?></td></tr>
							<tr><td><? echo $r["noidung"];?></td></tr>
							<tr>
								<td class="tieude3">
								bởi 
								<?
									$result2=mysql_query("select * from hocsinh where mahs='{$r["nguoidang"]}'");
									if(mysql_num_rows($result2)>0){
									while($r2=mysql_fetch_array($result2)){
										echo $r2["hotendem"];
										echo "&nbsp;";
										echo $r2["ten"];
									}}else {
										$result21=mysql_query("select * from giaovien where magv='{$r["nguoidang"]}'"); 
										$r21=mysql_fetch_array($result21);									
										echo $r21["hotendem"];
										echo "&nbsp;";
										echo $r21["ten"];
									}
								?>								 
								&nbsp;vào lúc &nbsp;<? echo $r["ngay"];?>
								</td>								
							</tr>
							<tr><td class="tieude3">thuộc 
							<a href="loaibaiviet.php?malbv=<? echo $r3["malbv"];?>&mal=<? echo $mal;?>"><?
							echo $r3["tenlbv"];
							?></a>
							</td></tr>
							<?
							$result7=mysql_query("select * from binhluanbaiviet where mabv='{$r["mabv"]}' and trangthai='1'");
							$n7=mysql_num_rows($result7);
							?>
							<tr><td class="tieude2">
							<?
								$kieu=$_REQUEST["option"];
								if(($kieu=="kogui")||($kieu=="")){
							?>
							Ý kiến bạn bè (<? echo $n7;?>)&nbsp;&nbsp;
										<? if(($_SESSION["quyen"]==3)||($_SESSION["quyen"]==4)) {?>
													<a href="?option=cogui&mal=<? echo $mal;?>&mabv=<? echo $mabv;?>">
															<img src="anh/them.png" height="13" width="13" border="0">&nbsp;Gửi ý kiến
													</a>
										<? }else if($_SESSION["quyen"]==1){?>
													<a href="?option=cogui&mal=<? echo $mal;?>&mabv=<? echo $mabv;?>">
															<img src="anh/them.png" height="13" width="13" border="0">&nbsp;Gửi ý kiến
													</a>
										<? }?>
							<? }
							else if($kieu=="cogui"){?>
							Ý kiến bạn bè (<? echo $n7;?>)&nbsp;&nbsp;
										<? if(($_SESSION["quyen"]==3)||($_SESSION["quyen"]==4)) {?>
																	<a href="?option=kogui&mal=<? echo $mal;?>&mabv=<? echo $mabv;?>">
																			<img src="anh/them.png" height="13" width="13" border="0">&nbsp;Gửi ý kiến
																	  </a>
										<? }else if($_SESSION["quyen"]==1){?>
																	<a href="?option=kogui&mal=<? echo $mal;?>&mabv=<? echo $mabv;?>">
																			<img src="anh/them.png" height="13" width="13" border="0">&nbsp;Gửi ý kiến
																	  </a>
										<? }?>
								<div class="noidungnhanxet">																
								<form action="thembinhluanbaiviet_action.php?mal=<? echo $mal;?>" name="f" method="post">
								<table align="center" cellpadding="0" cellspacing="2" border="0" width="100%">									
									<tr>
									<? $nguoidang=$_SESSION["username"];?>
										<input type="hidden" name="nguoidangid" id="nguoidangid" value="<? echo $nguoidang;?>">
										<input type="hidden" name="bvid" id="bvid" value="<? echo $mabv;?>">
										<td class="tieude1">
											<? 
												$nguoidang=$_SESSION["username"];
												$result9=mysql_query("select * from hocsinh where mahs='{$nguoidang}'");
												if(mysql_num_rows($result9)>0)
												{
													$r9=mysql_fetch_array($result9);
													echo $r9["hotendem"];echo "&nbsp;";echo $r9["ten"];
												}else {
													$result91=mysql_query("select * from giaovien where magv='{$nguoidang}'");
													$r91=mysql_fetch_array($result91);
													echo $r91["hotendem"];echo "&nbsp;";echo $r91["ten"];
												}									
											?>
										</td></tr>
									<tr>
										<td align="left">Nội dung</td>
									</tr>									
									<tr><td align="left"><textarea cols="55" rows="4" name="noidung"></textarea></td></tr>
									<tr><td align="left">
										<input type="submit" name="submit" value="Gửi">&nbsp;
										<input type="reset" name="reset" value="Bỏ qua">
									</td></tr>
								</table>
								</form>
								</div>
							<? }?>
							<? while($r7=mysql_fetch_array($result7)){?>
							<div class="noidungnhanxet">
								<table align="center" cellpadding="0" cellspacing="2" width="100%" border="0">
									<tr><td class="tieude1" align="left">
									<?
									$result23=mysql_query("select * from hocsinh where mahs='{$r7["nguoidang"]}'");
									if(mysql_num_rows($result23)>0){
										$r23=mysql_fetch_array($result23);
										echo $r23["hotendem"];
										echo "&nbsp;";
										echo $r23["ten"];
									}else {
										$result24=mysql_query("select * from giaovien where magv='{$r7["nguoidang"]}'"); 
										$r24=mysql_fetch_array($result24);									
										echo $r24["hotendem"];
										echo "&nbsp;";
										echo $r24["ten"];
									}
								?>											
									</td></tr>
									<tr><td class="tieude3" align="left"><? echo $r7["thoigian"];?></td></tr>
									<tr><td align="left"><? echo $r7["noidung"];?></td></tr>
								</table>
							</div>
							<? }?>
							</td></tr>							
						</table>			 
						<div class="cactinkhac">
							<table align="center" cellpadding="0" cellspacing="0" border="0" width="100%">
								<tr>
									<td align="left" class="tieude3">
										<img src="anh/dlet_artblock_point_1.gif" width="13" height="9" border="0" /><strong>Các bài viết khác</strong>										
									</td>
									<td align="right">
										<?
								if($_SESSION["quyen"]==1)
								{
								?>
									<a href="vietbai.php?mal=<? echo $mal;?>" title="Viết bài mới">
										<img src="anh/them.png" height="13" width="13" border="0">&nbsp;Viết bài mới
									</a>
								<?
								}else if(($_SESSION["quyen"]==3)||($_SESSION["quyen"]==4))
								{
									$mahs=$_SESSION["username"];
									$result4=mysql_query("select * from hocsinh where mahs='{$mahs}'");
									$r4=mysql_fetch_array($result4);
									if($mal==$r4["mal"])
									{
										?>
										<a href="vietbai.php?mal=<? echo $mal;?>" title="Viết bài mới">
										<img src="anh/them.png" height="13" width="13" border="0">&nbsp;Viết bài mới
										</a>
										<?
									}
								}
								?>
									</td>
								</tr>
								<?
									$result5=mysql_query("select * from hocsinh where mal='{$mal}'");
									while($r5=mysql_fetch_array($result5)){
									$result6=mysql_query("select * from baiviet where nguoidang='{$r5["mahs"]}' and mabv!='{$r["mabv"]}' and trangthai='1' order by ngay DESC limit 0,5");
									while($r6=mysql_fetch_array($result6)){
								?>
								<tr>
									<td colspan="2">&nbsp;&nbsp;<a href="baiviet_detail.php?mabv=<? echo $r6["mabv"];?>&mal=<? echo $mal;?>">
											<? echo $r6["tieude"];?>
										</a>
									</td>
								</tr>
								<? }}?>
							</table>
							
						</div>
					</div>
					<div class="gift_quatang_btmblog">
						<p class="gift_quatang_bl_left"><img src="anh/space.gif"></p>
						<p class="gift_quatang_bl_right"><img src="anh/space.gif"></p>
					</div>
			
				</div>
				<!--End-->					
		</td></tr>
	</table>
	<!-- InstanceEndEditable --></td>
	<!--menu phai-->
	<td width="190" valign="top" align="center">
		<div class="panel">
			<div class="panel_header">Thành viên lớp</div>
			<table align="center" width="100%" cellpadding="1" cellpadding="1" border="0">
			<tr>
			<?
				$resu4=mysql_query("select * from hocsinh where mal='{$malop}' ORDER BY RAND() LIMIT 12");
				$j=0;
				while($row4=mysql_fetch_array($resu4)){
					$j++;					
			?>
				<td>
				<div style=" border:1px solid #EEEEEE; padding:2px;">
				<a href="tranghocsinh.php?mahs=<? echo $row4["mahs"];?>&mal=<? echo $malop;?>" title="<? echo $row4["hotendem"]."&nbsp;".$row4["ten"];?>">
					<img src="thumb.php?h=41&w=41&url=anhhocsinh/<? echo $row4["anh"];?>" border="0"/>
				</a>
				</div>
				</td>
				<? if($j==4){?>			
			</tr><tr>
				<? 
				$j=0;
				}?>
			<? }?>
			</table>
		</div>
		<!--anh phai-->
		<div class="panel">
			<div class="panel_header">Album ảnh</div>
			<marquee height="300" width="100%" onmouseout="this.start()" onmouseover="this.stop()" scrolldelay="2" scrollamount="2" direction="up" behavior="scroll">
				<table align="center" width="99%" cellpadding="2" cellspacing="0" border="0" bgcolor="#FFFFFF">					
					<?
					$resu23=mysql_query("select * from thuvienanhlop where trangthai=1");
					while($row23=mysql_fetch_array($resu23)){
					?>
						<tr><td>
						<div style=" border:1px solid #EEEEEE; padding:4px;">
							<a href='chitietthuvienanh.php?maalbum=<? echo $row23["maalbum"];?>'>
								<img src="thumb.php?h=170&w=180&url=thuvienanh/<? echo $row23["duongdan"];?>" border="0"/>							
							</a>
						</div>
						</td>
						</tr>
					<? }?>     					
				</table>
			</marquee>	
		</div>
		<!--het anh phai-->
	</td>
	</tr>
	<tr><td colspan="3" align="center" valign="middle" bgcolor="#999999" height="100">Phạm Đức Đóa - Khoa CNTT - Đại học Xây Dựng</td></tr>
</table>
</body>
<!-- InstanceEnd --></html>
